package cmd

import (
	"gitee.com/xuender/se"
	"github.com/spf13/cobra"
)

// nolint: gochecknoinits
func init() {
	wordsCmd := &cobra.Command{
		Use:     "words",
		Short:   "显示索引的词",
		Long:    `显示索引的词`,
		Aliases: []string{"wl", "ws"},
		Run: func(cmd *cobra.Command, args []string) {
			ctx := se.NewContext(cmd)
			app := se.InitApp(ctx)
			defer app.Close()

			if len(args) > 0 {
				ctx.Start = args[0]
			}

			app.Words()
		},
	}

	wordsCmd.Flags().Uint("limit", 100, "显示条数")
	wordsCmd.Flags().String("start", "", "起始词")
	rootCmd.AddCommand(wordsCmd)
}
